<?php
   require(dirname(__FILE__).'/global.php');
   require(ROOT.'/admin/isLogin.php');
   
   $submit = $_POST['submit'];
   if(isset($submit))
   {
       $notice = $_POST['notice'];
       if(empty($notice))
       {
           $smarty->assign('tip','公告为空');
       }
       else
       {
           $noticeTime = DateUtil::get_YY_mm_dd_HH_mm_ss();
           $noticeManager = $_SESSION['user']['id'];
           
           $sql = "insert into talking_notice(NoticeContent,NoticeTime,NoticeManager) values('$notice','$noticeTime','$noticeManager')";
           $db->execute($sql);
           $smarty->assign('tip','发布成功');
       }
   }
   $smarty->display('notice.html');
   $db->close();
?>